package fz.vrd.library.page.activity;

import android.os.Bundle;

import androidx.activity.result.ActivityResult;
import androidx.activity.result.ActivityResultCallback;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;

import fz.vrd.library.page.Page;
import fz.vrd.library.page.PageImp;


/**
 * <b>类名称： 父类 activity <br/>
 * <b>创建人： Administrator <br/>
 * <b>时间： 2021/6/10 10:07 <br/>
 * <b>说明：{ } <br/>
 */


public abstract class BaseAc extends AppCompatActivity {

    protected Page page;

    protected ActivityResultCallback<ActivityResult> activityResultCallback = new ActivityResultCallback<ActivityResult>() {

        @Override
        public void onActivityResult(ActivityResult result) {

        }
    };

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        page = new PageImp(this);
        page.registerForActivityResult(activityResultCallback);
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
        super.onRequestPermissionsResult(requestCode, permissions, grantResults);
        page.getPermissionsManage().onRequestPermissionsResult(requestCode, permissions, grantResults);

    }

    public void back() {
        page.backPage();
    }


}
